package com.aistar.service.impl;

import com.aistar.mapper.CompanyMapper;
import com.aistar.pojo.Company;
import com.aistar.service.CompanyService;
import com.aistar.util.MyBatisUtil;
import com.aistar.util.ServerResponse;
import org.apache.ibatis.session.SqlSession;

public class CompanyServiceImpl implements CompanyService {
    @Override
    public ServerResponse save(Company company) {
        return null;
    }

    @Override
    public ServerResponse modifyStatus(Company company) {
        return null;
    }

    @Override
    public ServerResponse modify(Company company) {
        return null;
    }

    @Override
    public ServerResponse getById(Integer id) {
        SqlSession session = MyBatisUtil.getSqlSession();
        CompanyMapper mapper = session.getMapper(CompanyMapper.class);
        Company company = mapper.selectByPrimaryKey(id);
        MyBatisUtil.closeSqlSession();
        if(company==null)
            return ServerResponse.getDataFailed("暂无数据");

        return ServerResponse.getDataSuccess(company) ;
    }

    @Override
    public ServerResponse getAll() {
        return null;
    }
}
